<template>
  <div>
    <el-card class="mb20">
      <classify-form @search="handleSearch" ref="classifyForm" />
    </el-card>
    <el-card>
      <div class="mb20 fr">
        <el-tooltip class="item" content="新增考评项目分类" effect="dark" placement="top">
          <el-button
            size="small"
            type="primary"
            v-if="$auth('eval:add')"
            @click="handleEdit(false, {})"
            icon="el-icon-plus"
          />
        </el-tooltip>
        <el-tooltip class="item" content="刷新" effect="dark" placement="top">
          <el-button size="small" @click="handleSearch" icon="el-icon-refresh" />
        </el-tooltip>
      </div>
      <classify-table @edit="handleEdit" ref="classifyTable" />
    </el-card>
    <classify-modal @refresh="handleSearch({})" ref="classifyModal" />
  </div>
</template>

<script>
import ClassifyForm from './ClassifyForm'
import ClassifyTable from './ClassifyTable'
import ClassifyModal from './ClassifyModal'

export default {
  components: {
    ClassifyForm,
    ClassifyTable,
    ClassifyModal
  },
  methods: {
    handleSearch(param) {
      this.$refs.classifyTable.handleGetList(param)
    },
    handleEdit(bool, row) {
      this.$refs.classifyModal.edit(bool, row)
    }
  }
}
</script>
